//
//  PersonageViewController.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/2/25.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "PersonageViewController.h"


#import "ZiViewController.h"//个人资料
#import "MyLetterViewController.h"//我的站内信
#import "ChengJiViewController.h"//我的业绩
#import "MyMoneyViewController.h"//我的佣金
#import "AboutViewController.h"
@interface PersonageViewController ()

@end

@implementation PersonageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"个人中心";
    self.view.backgroundColor = BgColor;


    UIButton *peopleBtn= [UIButton buttonWithType:UIButtonTypeCustom];
    peopleBtn.frame = CGRectMake(0, 74, B_WIDTH, 90);
    peopleBtn.backgroundColor = [UIColor whiteColor];
    [peopleBtn setTitle:@"您好! 花花" forState:0];
    [peopleBtn setTitleColor:[UIColor blackColor] forState:0];
    peopleBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    peopleBtn.tag = 30;
    [peopleBtn addTarget:self action:@selector(selectedBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:peopleBtn];


    UIButton *tuiBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    tuiBtn.frame = CGRectMake(15, 420, B_WIDTH - 15*2, 40);
    tuiBtn.backgroundColor = OverColor;
    tuiBtn.layer.cornerRadius = 5;
    [tuiBtn setTitle:@"退出" forState:0];
    [tuiBtn setTitleColor:[UIColor whiteColor] forState:0];
    [tuiBtn addTarget:self action:@selector(tuiBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:tuiBtn];
    [self setUpButton];



}

-(void)setUpButton
{
    NSArray *titArr = @[@"     我的站内信",@"    我的业绩",@"    我的佣金",@"    关于"];
    NSArray *imgArr = @[@"znx",@"yeji",@"yongjin",@"guanyu"];
    for (int i = 0; i < titArr.count; i++)
    {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(0, 174+i*58, B_WIDTH, 50);
        btn.backgroundColor = [UIColor whiteColor];
      
        [btn setTitle:titArr[i] forState:0];
        [btn setTitleColor:[UIColor blackColor] forState:0];
        [btn setImage:[UIImage imageNamed:imgArr[i]] forState:0];
        btn.tag = 31 +i;
        //[btn layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:30];
        btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;//左对齐
        [btn setImageEdgeInsets:UIEdgeInsetsMake(5, 10, 5, 100)];
        [btn addTarget:self action:@selector(selectedBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
       // [btn setImageEdgeInsets:UIEdgeInsetsMake(<#CGFloat top#>, <#CGFloat left#>, <#CGFloat bottom#>, <#CGFloat right#>)];
        
        
    }
}

-(void)selectedBtnClick:(UIButton *)btn
{
    if (btn.tag == 30)
    {
        ZiViewController *ziVc = [[ZiViewController alloc] init];
        [self.navigationController pushViewController:ziVc animated:NO];
    }
    else if (btn.tag == 31)
    {
        MyLetterViewController *myLetterVc = [[MyLetterViewController alloc] init];
        [self.navigationController pushViewController:myLetterVc animated:NO];
    }
    else if (btn.tag == 32)
    {
        ChengJiViewController *chengJiVc = [[ChengJiViewController alloc] init];
        [self.navigationController pushViewController: chengJiVc animated:NO];
    }
    else if (btn.tag == 33)
    {
        MyMoneyViewController *myMoneyVC = [[MyMoneyViewController alloc] init];
        [self.navigationController pushViewController:myMoneyVC animated:NO];

        
    }
    else
    {
        AboutViewController *aboutVC = [[AboutViewController alloc] init];
        [self.navigationController pushViewController:aboutVC animated:NO];
    }
}

-(void)tuiBtnClick:(UIButton *)btn
{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
